# This is a sample Python script.
print("введите скобочную последовательность")
a1 = input()
a = []
p = {"(":")", "{":"}", "[":"]", "<":">"}
p1 = {"(", ")", "{", "}", "[", "]", "<", ">"}
stack = []
for i in a1:
    if i in p1:
        a.append(i)
t = 1
flag = False
for i in a:
    if i in p:
        stack.append(i)
    elif i == p[stack.pop()] and not stack and t == len(a):
        flag = True
    t += 1

print(flag)




















